<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>

<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>


<link rel="stylesheet" href="../css/duihua.css">


</head>
<body>




 <div id="main" class="main">
            <ul id="content" class="content">
                <li class="msgContent left">你好</li>
                <div style="clear:both"></div>
                <li class="msgContent right">你好</li>
                <div style="clear:both"></div>
                <li class="msgContent left">请问是想咨询什么问题</li>
                <div style="clear:both"></div>
                <li class="msgContent right">嗯aaaaa</li>
                <div style="clear:both"></div>
                <li class="msgContent left">asw</li>
                <div style="clear:both"></div>
                <li class="msgContent right">sdfew</li>
                <div style="clear:both"></div>
</ul>
<textarea id="msg_input" class="msgInput"></textarea>
<button id="sendbtn" class="sendbtn">发送</button>

<script type="text/javascript">
    $(function(){
        $('.sendbtn').click(function(){
            var content = $('#msg_input').val();
            $('#content').append('<li class="msgContent right">'+content+'<li>').append

('<div style="clear:both"></div>');
            $('#msg_input').val('')
            
        });
        
        $(window).keydown(function(e){
            if(e.ctrlKey && e.keyCode==13){
                var content = $('#msg_input').val();
                    $('#content').append('<li class="msgContent right">'+content

+'<li>').append('<div style="clear:both"></div>');
            $('#msg_input').val('')
            }
        })
    })
    
    
</script>




















    
</body>
</html>